home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 13
/
QRZ Ham Radio Callsign Database - Volume 13.iso
/
unix
/
src
/
jtod.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-23
|
844b
|
55 lines
#include <string.h>
jultodate(julyr,dob)
char *julyr;
char *dob;
{
int d;
int jd;
int day;
int yr;
int m;
/* J F M A M J J A S O N D */
static int n_year[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
static int l_year[] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
if (!strlen(julyr))
return;
sscanf(&julyr[2],"%d",&jd);
if (!jd)
return;
julyr[2] = '\0';
sscanf(julyr,"%d",&yr);
d = 0;
m = 0;
if (yr%4) {
while (d < jd)
d += n_year[m++];
d -= n_year[m-1];
}
else {
while (d < jd)
d += l_year[m++];
d -= l_year[m-1];
}
day = jd - d;
sprintf(dob,"%d/%d/%02d",m,day,yr);
}